package cn.edu.scujcc.customofsichuan.DataBase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class dbHelper extends SQLiteOpenHelper {

    public static dbHelper dbhelper = null;
    public static final String  USER_TABLE="UserInfo";
    public static final int  DB_VERSION=1;
    public dbHelper(Context context) {
        super(context, USER_TABLE, null, DB_VERSION);
    }

    //单例模式
    public dbHelper getInstance(Context context){
        if (dbhelper!=null){
            dbhelper=new dbHelper(context);
        }
        return dbhelper;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql="create table if not exists user (id integer primary key autoincrement,head_img BLOB, userName varchar(10),account_num varchar(16),password varchar(18))";
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
